/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "stdafx.h"

#include <线性代数/矢量计算.h>
#include <core/结构数据.h>

#include "数学/数学.h"


void f_math_mat44_变换m(const S_Vec3Array* dirA, const S_Mat44Array* dirB, S_Vec3Array* r) {
	uint32 num = dirA->count;

	f_core_array_resize((S_Array*)r, num);

	bool 是否单值 = dirB->count >= num;

	for (uint32 i = 0; i < num; ++i) {
		switch (是否单值) {
		case 0: r->ptr_userData[i] = (dirB->ptr_userData[0] * dirA->ptr_userData[i]); break;
		default: r->ptr_userData[i] = (dirB->ptr_userData[i] * dirA->ptr_userData[i]); break;
		}
	}
}


void f_math_mat44_相乘m(const S_Mat44Array* dirA, const S_Mat44Array* dirB, S_Mat44Array* r) {
	uint32 num = dirA->count;

	f_core_array_resize((S_Array*)r, num);

	bool 是否单值 = dirB->count >= num;

	for (uint32 i = 0; i < num; ++i) {
		switch (是否单值) {
		case 0: r->ptr_userData[i] = (dirB->ptr_userData[0] * dirA->ptr_userData[i]); break;
		default: r->ptr_userData[i] = (dirB->ptr_userData[i] * dirA->ptr_userData[i]); break;
		}
	}
}

Mat44f f_math_mat44_相乘(const Mat44f& dirA, const Mat44f& dirB) {
	return dirA * dirB;
}



